package com.hfzy.ihk.common.core.elasticsearch.enums;

import com.hfzy.ihk.common.facade.elasticsearch.entity.ElasticsearchTable;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/7/19.
 *
 * @author wws
 */
public enum CommonTables implements ElasticsearchTable {

    ALL("all", "表示任何表");

    private CommonTables(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private String value;

    private String desc;

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String getTableName() {
        return value;
    }

    private static Map<String, CommonTables> map = new HashMap<>();
    static {
        for (CommonTables value : CommonTables.values()) {
            map.put(value.getValue(), value);
        }
    }

    public static CommonTables fromValue(String value) {
        CommonTables ret = map.get(value);
        if (ret != null) {
            return ret;
        } else {
            throw new IllegalArgumentException("No enum const " + CommonTables.class + "." + value);
        }
    }

}
